Last Update: 2025/3/26
Gizmo OpenAI Action API
The Gizmo OpenAI Action API does not support streaming and only support > gizmo-gpt4o
. It involves calling a third-party API, which may require multiple interface requests triggered by the action click event.
Endpoint
POST https://platform.llmprovider.ai/v1/action
Request Headers
Header | Value |
---|---|
Authorization | Bearer YOUR_API_KEY |
Content-Type | application/json |
Request Body
The request body should be a JSON object with the following parameters:
Parameter | Type | Description |
---|---|---|
gizmo_id | string | Unique identifier for the Gizmo instance. |
action | string | Specifies the action to be performed. |
messages | array | List of messages in the conversation. |
parent_message_id | string | (Optional) ID of the parent message in the conversation. |
conversation_id | string | (Optional) ID of the conversation. |
stream | bool | (Optional) Whether to enable streaming response (false by default). |
model | string | The model to use (e.g., gizmo-gpt-4o ). |
history_and_training_disabled | bool | (Optional) Whether to disable history and training data storage. |
Message Structure (ChatCompletionMessage
)
Parameter | Type | Description |
---|---|---|
role | string | Role of the message (user , assistant , etc.). |
name | string | Name of the entity sending the message. |
content | string | Message text content. |
attachments | array | (Optional) List of file attachments. |
parts | array | (Optional) List of content parts (e.g., images). |
Attachment Structure (Attachment
)
Parameter | Type | Description |
---|---|---|
id | string | Unique identifier of the attachment. |
name | string | Original filename. |
size | int64 | File size in bytes. |
fileTokenSize | int | (Optional) Token size for processing the file. |
mimeType | string | MIME type of the file. |
width | int | (Optional) Image width (if applicable). |
height | int | (Optional) Image height (if applicable). |
oss_url | string | (Optional) URL of the file stored in OSS. |
Part Structure (Part
)
Parameter | Type | Description |
---|---|---|
name | string | Name of the content part. |
asset_pointer | string | Reference to the asset location. |
size_bytes | int | Size of the part in bytes. |
width | int | Image width (if applicable). |
height | int | Image height (if applicable). |
mimeType | string | MIME type of the part. |
image_data | string | (Optional) Base64-encoded image data. |
oss_url | string | (Optional) URL of the asset stored in OSS. |
Example Request
{
"messages": [
{
"role": "user",
"content": "1+2+3+....1000=?"
}
],
"model": "gizmo-gpt-4o",
"stream": false,
"gizmo_id": "g-HMNcP6w7d"
}
Response Body
The response body will be a JSON object containing the generated completions and other metadata.
Example Request
- Shell
- nodejs
- python
curl -X POST https://platform.llmprovider.ai/v1/action \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "1+2+3+....1000=?"
}
],
"model": "gizmo-gpt-4o",
"stream": false,
"gizmo_id": "g-HMNcP6w7d"
}'
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://platform.llmprovider.ai/v1/action';
const data = {
stream: false,
gizmo_id: 'g-HMNcP6w7d',
model: 'gizmo-gpt-4o',
messages: [
{
role: 'user',
"content": '1+2+3+....1000=?'
}
]
};
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
axios.post(url, data, { headers })
.then(response => {
console.log('Response:', response.data);
})
.catch(error => {
console.error('Error:', error);
});
import requests
import json
api_key = 'YOUR_API_KEY'
url = 'https://platform.llmprovider.ai/v1/action'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
data = {
'stream': False,
'gizmo_id': 'g-HMNcP6w7d',
'model': 'gizmo-gpt-4o',
'messages': [
{
'role': 'user',
"content": '1+2+3+....1000=?'
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
print('Response:', response.json())
else:
print('Error:', response.status_code, response.text)
For any questions or further assistance, please contact us at [email protected].